package com.example.mqtt.conntroller;

import com.example.mqtt.model.HistoryVO;
import com.example.mqtt.model.YesterdayDataVO;
import com.example.mqtt.service.HistoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2025/5/5 14:15
 **/
@RestController
@RequestMapping("/api/history")
@RequiredArgsConstructor
public class HistoryController {

    private final HistoryService historyService;

    @GetMapping("/list")
    public List<HistoryVO> getHistoryList() {
        return historyService.getHistoryList();
//        HistoryVO build1 = HistoryVO.builder()
//                .id("114154")
//                .username("张三")
//                .phone("13170080209")
//                .dailyOrder(1)
//                .serviceDate(currentDate)
//                .serviceStatus(1)
//                .build();
//
//        HistoryVO build2 = HistoryVO.builder()
//                .id("114155")
//                .username("张三1")
//                .phone("13170080209")
//                .dailyOrder(2)
//                .serviceDate(currentDate)
//                .serviceStatus(3)
//                .build();
//
//        HistoryVO build3 = HistoryVO.builder()
//                .id("114156")
//                .username("张三2")
//                .phone("13170080209")
//                .dailyOrder(3)
//                .serviceDate(currentDate)
//                .serviceStatus(2)
//                .build();
//
//        return List.of(build1, build2, build3);
    }

    @GetMapping("/statistics")
    public YesterdayDataVO getYesterdayData() {
        String targetDate = LocalDate.now().plusDays(-1).toString();
        return historyService.getYesterdayData(targetDate);
//        return YesterdayDataVO.builder()
//                .yesterdayQueueCount(12)
//                .totalQueueCount(114)
//                .build();
    }
}
